<?php
declare (strict_types = 1);
/*
 * @Author: 小悟空56
 * @Date: 2022-02-25 16:41:56
 * @LastEditTime: 2022-02-25 16:43:04
 * @LastEditors: 小悟空56
 * @Description: 描述：
 * @FilePath: \copy.copy.com\app\admin\model\LoginLog.php
 * 白月光
 */
namespace app\admin\model;

use think\Model;

/**
 * @mixin \think\Model
 */
class LoginLog extends Model
{
    //
    protected $pk ="id";

    protected $table="loginlog";

    public function searchUsernameAttr($query, $value, $data)
    {

        return $value?$query->where('username','in', $value):'';
    }

    public function searchCreateTimeAttr($query, $value, $data)
    {
        $times = [];
        if ($value){
            $times = cut_time($value);
        }
       return $value?$query->whereBetweenTime('create_time', $times['bTime'], $times['eTime']):'';
    }

}
